
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <BMesh>
#include <BCamera>
#include <BLight>
#include <BScene>
#include <BReadWrite>
#include <BMaterial>
#include <BViewer>

#include <BGridLayout>
#include <BHBoxLayout>
#include <BVBoxLayout>
#include <BStackLayout>
#include <BDockLayout>
#include <BButton>
#include <BComboBox>
#include <BCheckBox>
#include <BFloatSpinBox>
#include <BTreeWidget>
#include <BGroupBox>
#include <BMainWindow>

#include "BodyBoard.h"
#include "ShapeBoard.h"
#include "RestraintBoard.h"
#include "MainHandler.h"

class MainWindow : public BMainWindow
{
public:
	MainWindow();

protected:
	void slotSceneUpdated(BScene* scene, const BValue& value);
	void slotScenePaused(BScene* scene, const BValue& value);

	void slotResetButtonClicked(BObject* object, const BValue& value);
	void slotPauseButtonToggled(BObject* object, const BValue& value);
	void slotTreeItemDoubleClicked(BObject* object, const BValue& value);

	void slotAppendPanel(BObject* object, const BValue& value);
	void slotRemovePanel(BObject* object, const BValue& value);
	void slotEditNode(BObject* object, const BValue& value);
	void slotEditShape(BObject* object, const BValue& value);
	void slotEditRestraint(BObject* object, const BValue& value);
	void slotShowNote(BObject* object, const BValue& value);
	void slotHideNote(BObject* object, const BValue& value);

	void slotDragImpulseEditFinished(BObject* object, const BValue& value);
	void slotSignSleepsCheckBoxToggled(BObject* object, const BValue& value);
	void slotShowContactsCheckBoxToggled(BObject* object, const BValue& value);
	void slotOnlyDynamicsCheckBoxToggled(BObject* object, const BValue& value);

protected:
	virtual void showEvent(const BEvent& event);

	virtual void updateEvent(const BEvent& event);

	virtual void styleEvent(const BEvent& event);

private:
	BScene*				_scene;
	BViewer*			_viewer;
	BDockLayout*		_dockLayout;
	BTreeWidget*		_treeWidget;
	MainHandler*		_mainHandler;
	BButtonHolder		_resetButton;
	BButtonHolder		_startButton;
	BRealSpinBox*		_timeSpinBox;

	BVBoxLayout*		_panelLayout;
	BodyBoard*			_bodyBoard;
	ShapeBoard*			_shapeBoard;
	RestraintBoard*		_restraintBoard;
	BFloatSpinBox*		_dragImpulseSpinBox;
	BCheckBox*			_signSleepsCheckBox;
	BCheckBox*			_showContactsCheckBox;
	BCheckBox*			_onlyDynamicBodyCheckBox;
	BSpinBox*			_broadphaseInfoSpinBox;
	BSpinBox*			_manifoldCountSpinBox;
	BSpinBox*			_realFreqencySpinBox;
};

#endif